package org.csu.mypetstoreplus.persistence;

import org.csu.mypetstoreplus.entity.Order;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface OrderDao extends JpaRepository<Order, Integer> {
    @Query(value = "select * from orders where userid =?1", nativeQuery = true)
    List<Order> findByUsername(String username);
    @Query(value = "select * from orders where orderid =?1", nativeQuery = true)
    Order findByOrderId(int orderId);
}
